import { S } from '../../s';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSEditor } from '../ipseditor';
import { IPSDEGrid } from './ipsdegrid';
import { IPSDEGridEditItem } from './ipsdegrid-edit-item';
import { IPSDEGridEditItemUpdate } from './ipsdegrid-edit-item-update';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class HiddenPSDEGridEditItemImpl
  extends PSModelObjectImpl
  implements IPSDEGridEditItem
{
  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get createDV(): string {
    return this.M.createDV;
  }

  get createDVT():
    | 'SESSION'
    | 'APPLICATION'
    | 'UNIQUEID'
    | 'CONTEXT'
    | 'PARAM'
    | 'OPERATOR'
    | 'OPERATORNAME'
    | 'CURTIME'
    | 'APPDATA' {
    return this.M.createDVT;
  }

  get enableCond(): 0 | 1 | 2 | 3 {
    return this.M.enableCond;
  }

  get ignoreInput(): 0 | 1 | 2 | 3 {
    return this.M.ignoreInput;
  }

  get outputCodeListConfigMode(): 0 | 1 | 2 {
    return this.M.outputCodeListConfigMode != null
      ? this.M.outputCodeListConfigMode
      : 0;
  }

  protected psappdefield: IPSAppDEField;
  getPSAppDEField(): IPSAppDEField | null {
    return (
      this.psappdefield ||
      (this.psappdefield = this.fillObjectModel(
        S._1,
        this.M.getPSAppDEField,
        S._2e4,
      ) as IPSAppDEField)
    );
  }

  protected psdegridedititemupdate: IPSDEGridEditItemUpdate;
  getPSDEGridEditItemUpdate(): IPSDEGridEditItemUpdate | null {
    if (this.psdegridedititemupdate != null) return this.psdegridedititemupdate;
    const value = this.M.getPSDEGridEditItemUpdate;
    if (value == null) {
      return;
    }
    const ipsdegrid = this.getParentPSModelObject(S._24d) as IPSDEGrid;
    if (ipsdegrid != null) {
      this.psdegridedititemupdate = ipsdegrid.findPSDEGridEditItemUpdate(value);
    }
    return this.psdegridedititemupdate;
  }

  protected pseditor: IPSEditor;
  getPSEditor(): IPSEditor | null {
    return (
      this.pseditor ||
      (this.pseditor = this.fillObjectModel(
        S._12e,
        this.M.getPSEditor,
        S._2f0,
      ) as IPSEditor)
    );
  }

  get resetItemName(): string {
    return this.M.resetItemName;
  }

  get unitName(): string {
    return this.M.unitName;
  }

  get unitNameWidth(): number {
    return this.M.unitNameWidth != null ? this.M.unitNameWidth : 0;
  }

  get updateDV(): string {
    return this.M.updateDV;
  }

  get updateDVT():
    | 'SESSION'
    | 'APPLICATION'
    | 'UNIQUEID'
    | 'CONTEXT'
    | 'PARAM'
    | 'OPERATOR'
    | 'OPERATORNAME'
    | 'CURTIME'
    | 'APPDATA' {
    return this.M.updateDVT;
  }

  get valueItemName(): string {
    return this.M.valueItemName;
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty;
  }

  get convertToCodeItemText(): boolean {
    return this.M.convertToCodeItemText != null
      ? this.M.convertToCodeItemText
      : false;
  }

  get enableUnitName(): boolean {
    return this.M.enableUnitName != null ? this.M.enableUnitName : false;
  }

  get needCodeListConfig(): boolean {
    return this.M.needCodeListConfig != null
      ? this.M.needCodeListConfig
      : false;
  }
  get cls(): string {
    return 'HiddenPSDEGridEditItemImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._c4) return true;
    return super.instanceof(cls);
  }
}
